// 封装所有请求频道的方法

import request from '@/utils/request.js'

/**
 *  封装请求用户频道列表文章的方法
 * @param {*}
 * @returns  promise
 */

export const getAllChannels = () => {
  return request({
    url: '/v1_0/channels'
  })
}

/**
 * 新增用户频道的方法
 * @param {*} channel {id. seq}
 * @returns promise
 */
export const addUserChannel = channel => {
  return request({
    url: '/v1_0/user/channels',
    method: 'PATCH',
    data: {
      channels: [channel]
    }
  })
}

export const deleteUserChannel = id => {
  return request({
    url: '/v1_0/user/channels/' + id,
    method: 'DELETE'
  })
}
